package com.lol.controller;


import com.lol.tool.LOLResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lol.service.UserService;
import javax.annotation.Resource;
import com.lol.pojo.User;


@Controller
@RequestMapping("/user")
public class UserControl  {

    @Autowired
    private UserService userService;

    @RequestMapping("/login.do")
    @ResponseBody
    public LOLResult<User> toLogin(String email, String password) throws Exception {
        //调用userService处理登录
        System.out.println(email + "|" + password);
        LOLResult<User> LOLResult = userService.checkLogin(email, password);

        return LOLResult;
    }

    @ResponseBody
    @RequestMapping("/adduser.do")
    public LOLResult<User> toAdduser(String email, String password, String nickName) throws Exception {
        System.out.println(email+"|"+password+"|"+nickName);
        //调用userService处理登录
        LOLResult<User> LOLResult = userService.addUser(email, password, nickName);

        return LOLResult;
    }



}
